package psd.model.Prolog.Converters;

import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ContinueStatement;
import org.eclipse.jdt.core.dom.SimpleName;

import psd.model.IConverter;
import psd.model.Prolog.FactGenerationToolbox;
import psd.model.Prolog.PrologConverter;


public class PrologContinueStatementConverter extends PrologConverter implements
IConverter<ContinueStatement>{

	public PrologContinueStatementConverter(FactGenerationToolbox toolbox) {
		super(toolbox);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean convert(ContinueStatement node) {
		SimpleName l = node.getLabel();
        String target;
        String label;
        if(l != null)
        {
            label = quote(l.getIdentifier());
            target = idResolver.getID((ASTNode)labels.get(l.getIdentifier()));
        } else
        {
            label = "'null'";
            target = idResolver.getID(getEnclosingIterator(node));
        }
        String args[] = {
            label, target
        };
        createBodyFact(node, "continueT", args);
        return true;
	}

}
